﻿namespace IslandUnit
{
    /// <summary>
    /// Contains available actions to <see cref="MockSetup&lt;TDependency&gt;"/>
    /// </summary>
    /// <typeparam name="TDependency">The type of the dependency.</typeparam>
    public class MockAction<TDependency> : IHideObjectMembers, IDependencySetupFlow where TDependency : class
    {
        private readonly Dependency<TDependency> _dependency;

        /// <summary>
        /// Initializes a new instance of the <see cref="MockAction&lt;TDependency&gt;"/> class.
        /// </summary>
        /// <param name="dependency">The <see cref="Dependency&lt;TDependency&gt;"/> of your dependency.</param>
        public MockAction(Dependency<TDependency> dependency)
        {
            this._dependency = dependency;
        }

        /// <summary>
        /// Returns to the <see cref="Dependency&lt;TDependency&gt;"/>, to
        /// permit the flow of fluent interface.
        /// </summary>
        /// <returns>The <see cref="ICreateIsolation&lt;TDependency&gt;"/> of your dependency.</returns>
        public ICreateIsolation<TDependency> And()
        {
            return this._dependency;
        }

        /// <summary>
        /// Returns to the <see cref="Isolator"/>, to
        /// permit the flow of fluent interface.
        /// </summary>
        /// <returns>The <see cref="Isolator"/>.</returns>
        public IDependencySetup Then()
        {
            return this._dependency.Isolator;
        }
    }
}
